#ifndef RECORDER_FUN
#define RECORDER_FUN

#include <windows.h>

#include "config.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
#include "libavcodec/avcodec.h"

#define STREAM_FRAME_RATE 300
#define STREAM_PIX_FMT PIX_FMT_YUV420P /* default pix_fmt */
#define STREAM_NB_FRAMES  ((int)(STREAM_DURATION * STREAM_FRAME_RATE))

#define REGISTER_MUXER(X,x) { \
    extern AVOutputFormat x##_muxer; \
    if(CONFIG_##X##_MUXER) av_register_output_format(&x##_muxer); }

#define REGISTER_DEMUXER(X,x) { \
    extern AVInputFormat x##_demuxer; \
    if(CONFIG_##X##_DEMUXER) av_register_input_format(&x##_demuxer); }

#define REGISTER_MUXDEMUX(X,x)  REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)

#define REGISTER_ENCODER(X,x) { \
          extern AVCodec x##_encoder; \
          if(CONFIG_##X##_ENCODER)  avcodec_register(&x##_encoder); }

#define REGISTER_PROTOCOL(X,x) { \
    extern URLProtocol x##_protocol; \
    if(CONFIG_##X##_PROTOCOL) av_register_protocol(&x##_protocol); }

int getScreenshotWithCursor( void*, int, int, int, int );
int lineSizeOfFrame( int );
void SetError( const char* );
void ClearError();
char * GetError();
void register_mpeg();
AVFrame *alloc_picture( enum PixelFormat, int, int );
AVStream *add_video_stream( AVFormatContext*, enum CodecID );
void open_video( AVFormatContext*, AVStream* );
void write_video_frame( AVFormatContext*, AVStream*, uint8_t* );
void close_video( AVFormatContext*, AVStream* );

#endif //RECORDER_FUN
